{:W('Template/top')}
<div class="wrapper clearfix content" style="position: relative;border: 1px solid #ddd">
    {:W('Template/left')}
    <div class="rightbox pull-right">
        <div class="ur-here">您当前的位置：<a href="#">订单管理</a>&gt;通用产品订单</div>
        <div class="cTitle2">通用产品订单</div>
        <in name="Think.session.role_id" value="$operatorData">
            <input type="hidden" class="operatorId" value="{$oid}">

            <div class="status">
                <label>运营商：</label>
                <a class="nav-operator-state nav-operator-state0"
                   href="{:U('Order/productList', array('id' => I('get.id'), 'oid' => 0))}" style="margin-left:5px;">全部
                </a>
                <foreach name="operatorList" item="vo">
                    <a class="nav-operator-state nav-operator-state{$vo.id}"
                       href="{:U('Order/productList', array('id' => I('get.id'), 'oid' => $vo['id']))}">{$vo.display_name}
                    </a>
                </foreach>
            </div>
        </in>
        <div class="main-search">
            <div class="top clearfix">
                <form method="get" action="{:U('Order/productList',array('id' => I('get.id'), 'oid' => I('get.oid')))}" class="form-inline">
                    <div class="form-group">
                        <input type="text" class="form-control" name="names" placeholder="编号/代理/产品/供应商" value="{$name}"/>
                    </div>
                    <span style="margin-left: 50px"> </span>
                    <div class="form-group" style="margin-right: -40px;">
                        <select name="date_type" style="height:35px;line-height: 35px;border: 1px solid #c0c0c0">
                            <if condition="$dateType eq 2">
                                <option value="2">创建时间</option>
                                <else/>
                                <option value="2">创建时间</option>
                            </if>
                        </select>
                    </div>
                    <div class="form-group ml">
                        <label>时间：</label>
                        <input type="text" class="form-control ui-datepicker Wdate" name="start_time" placeholder="开始日期"
                               value="{$startTime}" id="d4322" onclick="WdatePicker({el: $dp.$('d12')})"
                               style="width:80%">
                    </div>
                    <span class="end">到</span>

                    <div class="form-group">
                        <label class="sr-only"></label>
                        <input type="text" class="form-control ui-datepicker Wdate" name="end_time" placeholder="结束日期"
                               value="{$endTime}" id="d4322" onclick="WdatePicker({el: $dp.$('d12')})">
                    </div>
                    <button type="submit" class="btn btn-warning">查询</button>

                    <input type="hidden" id="chkState" value="{:U('Order/productList')}"/>
                    <input type="hidden" id="showProof" value="{:U('Agency/showProofInfo')}">
                    <input type="hidden" id="type" value="product">
                    <input type="hidden" id="showPara" value="{:U('Order/showParaInfo')}">
                    <input type="hidden" id="addPara" value="{:U('Order/addParaInfo')}">
                </form>
            </div>
            <p></p>

            <form method="post" action="{:U('GetApplyExcel/getProductExcel',array('id' => I('get.id'), 'oid' => I('get.oid')))}">
                <input type="hidden" name="sname" value="{$name}">
                <input type="hidden" name="start_time" value="{$startTime}">
                <input type="hidden" name="end_time" value="{$endTime}">
                <input type="hidden" name="date_type" value="{$dateType}">
                <input type="submit" class="btn btn-success" value="导出生成Excel">
            </form>
        </div>
        <table class="cTable table-hover" width="100%">
            <tr>
                <th width="5%">编号</th>
                <th width="10%">代理商</th>
                <th width="10%">产品名称</th>
                <th width="10%">供应商</th>
                <th width="5%">数量</th>
                <th width="8%">同行价</th>
                <th width="8%">成本价</th>
                <th width="10%"><a href="javascript:void(0)" data-toggle="tooltip" data-placement="top" title="供应商实际收入">实际收入</a></th>
                <th width="10%">佣金</th>
                <th width="10%">利润</th>
                <th width="10%">下单时间</th>
                <th width="10%">参数</th>
                <th width="10%">凭证</th>
                <th width="10%">状态</th>
                <th width="10%">操作</th>
            </tr>
            <volist name="info" id="vo">
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.agency_name}</td>
                    <td class="text-c1">{$vo.product_name}</td>
                    <td>{$vo.provider_name}</td>
                    <td>{$vo.quantity}</td>
                    <td>{$vo['price_agency']|getYuan}</td>
                    <td>{$vo.price_cost|getYuan}</td>
                    <td id="money-right" class="text-c5">
                        <if condition="$vo['state'] eq 6">
                            {$vo.prepay_amount_commission|GetYuan}
                            <elseif condition="$vo['state'] eq 7"/>
                            {$vo.price_payable_commission|GetYuan}
                            <else/>
                            0.00
                        </if>
                    </td>
                    <td class="text-c5">
                        <if condition="$vo['state'] eq 6">
                            {$vo.prepay_commission|GetYuan}
                            <elseif condition="$vo['state'] eq 7"/>
                            {$vo.total_commission|GetYuan}
                            <else/>
                            0.00
                        </if>
                    </td>
                    <td class="text-c5">
                        <if condition="$vo['price_cost'] neq 0">
                        {$vo['price_agency'] * $vo['quantity'] - $vo['price_cost'] *
                        $vo['quantity']|getYuan}
                        <else/>
                        0.00
                        </if>
                    </td>
                    <td class="text-c1">{$vo.create_time}</td>
                    <td class="text-c1">
                        <if condition="$vo['para_type'] eq 1">
                            保险 {$vo.para_value}
                        <else/>
                            {$vo.para_type} {$vo.para_value}
                        </if>
                    </td>
                    <td class="text-c1">{$vo.proof_type} {$vo.proof_code}</td>
                    <td>
                        <if condition="$vo.state eq 1"><span style="color:red">未提交</span>
                            <elseif condition="$vo.state eq 2"/>
                            <a href="javascript:void(0)" data-toggle="tooltip" data-placement="top" title="{$vo.memo}"
                               style="text-decoration: none"><span style="color:blue">已提交</span></a>
                            <elseif condition="$vo.state eq 3"/>
                            <a href="javascript:void(0)" data-toggle="tooltip" data-placement="top" title="{$vo.memo}"
                               style="text-decoration: none"><span style="color:darkgreen">已确认待付款</span></a>
                            <elseif condition="$vo.state eq 4"/>
                            <a href="javascript:void(0)" data-toggle="tooltip" data-placement="top" title="{$vo.memo}"
                               style="text-decoration: none"><span style="color:red">已取消</span></a>
                            <elseif condition="$vo.state eq 5"/>
                            <a href="javascript:void(0)" data-toggle="tooltip" data-placement="top" title="{$vo.memo}"
                               style="text-decoration: none"><span style="color:red">已关闭</span></a>
                            <elseif condition="$vo.state eq 6"/>
                            <a href="javascript:void(0)" data-toggle="tooltip" data-placement="top" title="{$vo.memo}"
                               style="text-decoration: none"><span style="color:darkgreen">已付预付款</span></a>
                            <elseif condition="$vo.state eq 7"/>
                            <a href="javascript:void(0)" data-toggle="tooltip" data-placement="top" title="{$vo.memo}"
                               style="text-decoration: none"><span style="color:blue">已付全款</span></a>
                        </if>
                    </td>
                    <td>
                        <div class="btn-group">
                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                                    aria-expanded="false">
                                操作<span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu" role="menu">
                                <li><a style="cursor: pointer" onclick="updateProof({$vo.id}, '{$vo.id|setEncrypt}', {$vo.state}, 6)">凭证</a></li>
                                <li><a style="cursor: pointer" onclick="showPara({$vo.id})">参数</a></li>
                            </ul>
                        </div>
                    </td>
                </tr>
            </volist>
        </table>
        <notempty name="info">
            <div class="pagebox">
                {$page}
            </div>
        </notempty>
    </div>
</div>

<div class="modal fade" id="myModalEdit" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:300px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    凭证信息
                </h4>
            </div>
            <div class="modal-body">
                凭证类型：
                <input type="text" class="proof_type form-control" style="border:1px solid #e5e5e5">

                <p>
                    凭证号码：
                    <input type="text" class="proof_code form-control" style='border:1px solid #e5e5e5'>

                <p>
            </div>
            <div class="modal-footer">
                <div class="pull-right">
                    <button type="button" class="btn btn-primary doSubmitTopup">
                        确定
                    </button>
                    <button type="button" class="btn btn-default cancel"
                            data-dismiss="modal">关闭
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="myModalPara" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:300px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    参数信息
                </h4>
            </div>
            <div class="modal-body">
                参数类型：
                <input type="text" class="para_type form-control" style="border:1px solid #e5e5e5">
                <p>
                    参数值：
                    <input type="text" class="para_value form-control" style='border:1px solid #e5e5e5'>
                <p>
            </div>
            <div class="modal-footer">
                <div class="pull-right">
                    <button type="button" class="btn btn-primary doSubmitTopup">
                        确定
                    </button>
                    <button type="button" class="btn btn-default cancel"
                            data-dismiss="modal">关闭
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

{:W('Template/bottom')}
<script>
    $(function () {
        $("[data-toggle='tooltip']").tooltip();
    });
</script>
</body>
</html>